class UsersKeys
  attr_accessor :github

  def initialize(github)
    @github = github
  end

  def listPublicKeys()
    @github.get('user/keys')
  end

  def getPublicKey(id)
    @github.get('user/keys/%s' % id)
  end

  def createPublicKey(title, key)
    params = {
        :title => title,
        :key => key
    }
    data = params.to_json
    @github.post('user/keys', data)
  end

  def updatePublicKey(id, title, key)
    params = {
        :title => title,
        :key => key
    }
    data = params.to_json
    @github.patch('user/keys/%s' % id, data)
  end

  def deletePublicKey(id)
    @github.delete('user/keys/%s' % id)
  end
end